/*
 * OpenSCAD File with the code to draw a part of the quadcopter in 3D
 * Part Number: 08
 * Version: 0.01
 * Units: mm
 * Last Modification: Mon Jun 28 19:40:21 WEST 2010
 *
 * Copyright (C) 2010 Henrique Dias <henrique.ribeiro.dias@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

frominclude = 0;

p08_height = 2+1.25+3.02+11.314+0.733+1.25+2;

module p08_subcomponent()
{
	cylinder(h=p08_height+1, r=2, center=true, $fn=60);
	// hole for xz cylinder
	rotate(a=[0, 45, 0]) {
		translate(v = [3.71, 0, 15/2+5-3.71]) {
			cylinder(h=15, r=2, center=true, $fn=60);
		}
	}

	// holes for rings
	rotate(a=[90,0,0]) {
		translate(v = [4+1.25, -(p08_height/2)+3.25, 0]) {
			cylinder(h=4, r=1.25, center=true, $fn=60);
		}
	}
	rotate(a=[90,0,0]) {
		translate(v = [4+1.25, (p08_height/2)-3.25, 0]) {
			cylinder(h=4, r=1.25, center=true, $fn=60);
		}
	}
}

module p08_addcomponent()
{
	cylinder(h=p08_height, r=4, center=true, $fn=60);
	// support bar
	translate(v = [((1+3.25)/2)+1, 0, 0]) {
		cube(size = [1+3.25, 2, p08_height], center=true);
	}
	// rings
	rotate(a=[90,0,0]) {
		translate(v = [4+3.25-2, -(p08_height/2)+3.25, 0]) {
			cylinder(h=2, r=3.25, center=true, $fn=60);
		}
	}
	rotate(a=[90,0,0]) {
		translate(v = [4+3.25-2, (p08_height/2)-3.25, 0]) {
			cylinder(h=2, r=3.25, center=true, $fn=60);
		}
	}
	// xz cylinder
	rotate(a=[0, 45, 0]) {
		translate(v = [3.71, 0, 20/2+5-3.71-5]) {
			cylinder(h=20, r=4, center=true, $fn=60);
		}
	}

}

module part08()
{
	difference() {
		union() {
			p08_addcomponent();
		}
		p08_subcomponent();
	}
}

if(frominclude == 0) {
	part08();
}
